#include "comm.hpp"

int main()
{
	FifoPipe fifo(FIFO_NAME, PATH);
	FifoWork fifowork(FIFO_NAME, PATH);
	fifo.CreatePipe();

	Shm shm(CREATETOR);
	fifowork.OpenForServer();

	char *arr = (char *)shm.VirtualAdd();
	for (int i = 0; i < 20; i++)
	{
		if (fifowork.Wait())
		{
			std::cout << "Server received: " << arr << std::endl;
			sleep(2);
		}
	}

	fifowork.Close();

	std::cout << "Server process finished." << std::endl;

	return 0;
}